package m202406.d05;

import java.util.*;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/6/5 21:46
 */
public class OD_T02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] bs = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int[] ws = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        Set<Position> bSet = compute(bs);
        Set<Position> wSet = compute(ws);
        for (int i = 0; i < bs.length - 1; i = i + 2) {
            Position position = new Position(bs[i], bs[i + 1]);
            bSet.remove(position);
            wSet.remove(position);
        }
        for (int i = 0; i < ws.length - 1; i = i + 2) {
            Position position = new Position(ws[i], ws[i + 1]);
            bSet.remove(position);
            wSet.remove(position);
        }
        System.out.println(bSet.size() + " " + wSet.size());
    }

    private static Set<Position> compute(int[] position) {
        Set<Position> set = new HashSet<>();
        for (int i = 0; i < position.length - 1; i = i + 2) {
            int row = position[i];
            int col = position[i + 1];
            if (row + 1 < 19) {
                set.add(new Position(row + 1, col));
            }
            if (row - 1 >= 0) {
                set.add(new Position(row - 1, col));
            }
            if (col + 1 < 19) {
                set.add(new Position(row, col + 1));
            }
            if (col - 1 >= 0) {
                set.add(new Position(row, col - 1));
            }
        }
        return set;
    }

    private static class Position {
        int row;
        int col;

        public Position(int row, int col) {
            this.row = row;
            this.col = col;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }
            Position position = (Position) o;
            return row == position.row && col == position.col;
        }

        @Override
        public int hashCode() {
            return Objects.hash(row, col);
        }
    }
}
